package ar.edu.itba.it.cg.grupo01.impl.shape.shader;

import java.awt.Color;

import javax.vecmath.Point3f;

import ar.edu.itba.it.cg.grupo01.api.shape.Shape;
import ar.edu.itba.it.cg.grupo01.impl.RayTraceInformation;
import ar.edu.itba.it.cg.grupo01.impl.color.Colors;

public class GlassShader extends Shader {

	private float eta;
	private Color color;
	private float absorbtionDistance;
	private Color absorbtionColor;

	@Override
	public float getReflectionK() {
		return 0.2f;
	}

	@Override
	public float getRefractionK() {
		return 1.0f;
	}

	public void setEta(float etaValue) {
		this.eta = etaValue;
	}

	public void setColor(Color parseColor) {
		this.color = parseColor;
	}

	public void setAbsorbtionDistance(float absorbtion) {
		this.absorbtionDistance = absorbtion;
	}

	public void setAbsorbtionColor(Color parseColor) {
		this.absorbtionColor = parseColor;
	}

	public Color getAbsorbtionColor() {
		return absorbtionColor;
	}

	public float getEta() {
		return eta;
	}

	public Color getColor() {
		return color;
	}

	public float getAbsorbtionDistance() {
		return absorbtionDistance;
	}

	@Override
	public Color getShadeColor(Shape shape, Point3f intersectionPoint) {
		return color;
	}

	@Override
	public Color shadeRefraction(Color refractionColor) {
		return Colors.mulTo(refractionColor, color);
	}

	@Override
	public Color shadeReflection(Color reflectionColor) {
		return Colors.mulTo(reflectionColor, color);
	}

	@Override
	public float getRefractionIndex() {
		return eta;
	}

	@Override
	public void shade(RayTraceInformation info) {
		info.getRefractionColor().mul(color);
		info.getReflectionColor().mul(color);
	}

}
